package com.roger.cmdkit.base;

public class CmdHelper {
    /**
     * if the target arg belong to args
     * @param ss      the args
     * @param s       target arg
     * @return        true or false
     */
    public static boolean isBelongArgs(String[] ss,String s){
        for (String tmp : ss){
            if(tmp.equals(s)) return true;
        }
        return false;
    }

    /**
     * get target argument
     * @param ss       the commend arguments
     * @param s        the flag before target argument
     * @return         target arg
     */
    public static String getNextArg(String[] ss ,String s){
        String arg="";
        for (int i=0;i<ss.length;i++){
            if (s.equals(ss[i]) && i<ss.length-1) arg=ss[i+1];
        }
        return arg;
    }
}
